﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using lt_pmbc_001.DTO;
using lt_pmbc_001.DAL;
using lt_pmbc_001.Helpers;
using GMap.NET;
using GMap.NET.MapProviders;
using GMap.NET.WindowsForms;
using GMap.NET.WindowsForms.Markers;

namespace lt_pmbc_001.Forms
{
    public partial class FrmHienThiMap : Office2007Form
    {
        private GMapOverlay top;
        private GMapMarker currentMarker;

        public FrmHienThiMap(string address)
        {
            InitializeComponent();

            // Retrieve long/lat itude
            Coordinate coordinate = Geocode.GetCoordinates(address);
            double latitude = coordinate.Latitude;
            double longitude = coordinate.Longitude;

            mainMap.Position = new PointLatLng(latitude, longitude);
            mainMap.MapProvider = GMapProviders.GoogleMap;
            mainMap.MinZoom = 8;
            mainMap.MaxZoom = 20;
            mainMap.Zoom = 15;
            mainMap.Manager.Mode = AccessMode.ServerAndCache;

            top = new GMapOverlay(mainMap, "top");
            mainMap.Overlays.Add(top);

            currentMarker = new GMapMarkerGoogleRed(mainMap.Position);
            top.Markers.Add(currentMarker);
        }
    }
}
